/* QtLua -- Lua bindings for Qt
   Copyright (C) 2011, Jarek Pelczar

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 3 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General
   Public License along with this library; if not, write to the
   Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301 USA

*/

#ifndef QLUASCRIPTDEBUGGER_P_H
#define QLUASCRIPTDEBUGGER_P_H

#include <QObject>
#include <QMenu>
#include <QToolBar>
#include <QWidget>
#include <QAction>
#include "qluascriptenginedebugger.h"

class QLuaScriptDebuggerPrivate;
class QLuaDebuggerAgent;
class QLuaScriptDebuggerWidgetFactoryInterface;

class QLuaScriptDebugger : public QObject
{
    Q_OBJECT
public:
    explicit QLuaScriptDebugger(QObject *parent = 0);
    ~QLuaScriptDebugger();

    QMenu * createStandardMenu(QWidget * parentWidget, QObject * actionParent);
    QToolBar * createStandardToolBar(QWidget * parentWidget, QObject * actionParent);
    QAction * action(QLuaScriptEngineDebugger::DebuggerAction action, QObject * actionParent);

    void attachAgent(QLuaDebuggerAgent * agent);
    void detachAgent();

    void setWidgetFactory(QLuaScriptDebuggerWidgetFactoryInterface * factory);

    QWidget * debuggerWidget(QLuaScriptEngineDebugger::DebuggerWidget widget) const;

signals:
    void started();
    void stopped();

private:
    Q_PRIVATE_SLOT(d, void _p_contextPop())
    Q_PRIVATE_SLOT(d, void _p_contextPush())
    Q_PRIVATE_SLOT(d, void _p_exceptionCatch(qint64, const QLuaScriptValue&))
    Q_PRIVATE_SLOT(d, void _p_exceptionThrow(qint64, const QLuaScriptValue&, bool))
    Q_PRIVATE_SLOT(d, void _p_functionEntry(qint64))
    Q_PRIVATE_SLOT(d, void _p_functionExit(qint64, const QLuaScriptValue&))
    Q_PRIVATE_SLOT(d, void _p_positionChange(qint64, int, int))
    Q_PRIVATE_SLOT(d, void _p_scriptLoad(qint64, QString, QString, int))
    Q_PRIVATE_SLOT(d, void _p_scriptUnload(qint64))
    Q_PRIVATE_SLOT(d, void _p_continue())
    Q_PRIVATE_SLOT(d, void _p_interrupt())
    Q_PRIVATE_SLOT(d, void _p_stepInto())
    Q_PRIVATE_SLOT(d, void _p_stepOver())
    Q_PRIVATE_SLOT(d, void _p_runToCursor())
    Q_PRIVATE_SLOT(d, void _p_runToNewScript())
    Q_PRIVATE_SLOT(d, void _p_stepOut())

private:
    friend class QLuaScriptDebuggerPrivate;
    QLuaScriptDebuggerPrivate * d;
};

#endif // QLUASCRIPTDEBUGGER_P_H
